﻿<shared:PageBase x:Class="Bymed.SpineScan.WPF.SelectTestItemPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
      xmlns:userControl="clr-namespace:Bymed.SpineScan.WPF.CustomizedUserControl"
      xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
      x:Name="CurrentPage"
      mc:Ignorable="d" 
      d:DesignHeight="800" d:DesignWidth="1200"
	  Title="SelectTestItemPage" Loaded="CurrentPage_Loaded" Style="{StaticResource DefaultPageStyle}"
      DataContext="{Binding SelectTestItem, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid Width="1200">
        <Grid.RowDefinitions>
            <!-- Main Content -->
            <RowDefinition Height="Auto" />
            <!-- Navigation Buttons -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.Background>
                <ImageBrush ImageSource="/Skins/Resource/Image/GrayRightAboveTabBackground.png" />
            </Grid.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <!-- Page Title -->
                    <RowDefinition Height="75" />
                    <!-- TestItem Info -->
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="选择测试" Margin="0,12,40,0" HorizontalAlignment="Right" Style="{StaticResource PageTitleTextBlock}" />
                <StackPanel Grid.Row="1" Margin="0,0,0,20" HorizontalAlignment="Center" Orientation="Horizontal">
                    <StackPanel Margin="0,-5,5,0">
                        <userControl:PatientBasicInfoDisplayUserControl DataContext="{Binding PatientBasicInfoDisplayViewModel}" 
                         Width="229" Height="379" VerticalAlignment="Top" />
                        <TextBlock Text="主治医师" Style="{StaticResource PatientInfoTextBlock}" HorizontalAlignment="Center" />
                        <Border Padding="10" Width="229">
                            <Border.Background>
                                <ImageBrush ImageSource="/Bymed.SpineScan.WPF;component/Skins/Resource/Image/PatientInfoBackground.png" />
                            </Border.Background>
                            <ComboBox x:Name="AttendingDoctorList" IsEditable="False" ItemsSource="{Binding AttendingDoctorList}" 
                                      SelectedItem="{Binding AttendingDoctor, Mode=OneWayToSource}">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Name}" Style="{StaticResource PatientInfoTextBlock}" />
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                            </ComboBox>
                        </Border>
                    </StackPanel>
                    <Grid Width="910" Margin="0,-30,10,0">
                        <Grid.Style>
                            <Style TargetType="{x:Type Grid}">
                                <Setter Property="Visibility" Value="Collapsed" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsSwitchToOriginalTestItems}" Value="False">
                                        <Setter Property="Visibility" Value="Visible" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Style>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="360" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="360" />
                        </Grid.ColumnDefinitions>
                        <Border Padding="15,35,15,45">
                            <Border.Background>
                                <ImageBrush ImageSource="/Skins/Resource/Image/GrayBackground.png" />
                            </Border.Background>
                            <ListBox x:Name="PredefinedCustomizedTestItemListBox" BorderThickness="0" 
	                                Background="Transparent" ItemsSource="{Binding PredefinedCustomizedTestItemList}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding ItemTitle}" />
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                                <interactivity:Interaction.Triggers>
                                    <interactivity:EventTrigger EventName="MouseDoubleClick">
                                        <interactivity:InvokeCommandAction Command="{Binding AddCustomizedTestItemCommand}" 
							   CommandParameter="{Binding SelectedItem, ElementName=PredefinedCustomizedTestItemListBox}" />
                                    </interactivity:EventTrigger>
                                </interactivity:Interaction.Triggers>
                            </ListBox>
                        </Border>
                        <StackPanel Grid.Column="1" Width="40" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <Button Tag="/Skins/Resource/Image/AddItem.png" HorizontalAlignment="Center" Width="35" 
                                Style="{StaticResource OpacityImageButton}" Command="{Binding AddCustomizedTestItemCommand}" 
                                CommandParameter="{Binding SelectedItem, ElementName=PredefinedCustomizedTestItemListBox}" />
                            <Button Tag="/Skins/Resource/Image/RemoveItem.png" HorizontalAlignment="Center" Width="35" 
                                Style="{StaticResource OpacityImageButton}" Command="{Binding RemoveCustomizedTestItemCommand}" 
                                CommandParameter="{Binding SelectedItem, ElementName=SelectedCustomizedTestItemListBox}" />
                        </StackPanel>
                        <Border Grid.Column="2"  Padding="15,35,15,45">
                            <Border.Background>
                                <ImageBrush ImageSource="/Skins/Resource/Image/GrayBackground.png" />
                            </Border.Background>
                            <ListBox x:Name="SelectedCustomizedTestItemListBox" Background="Transparent"
                                BorderThickness="0" ItemsSource="{Binding SelectedCustomizedTestItemList}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding ItemTitle}" />
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                                <interactivity:Interaction.Triggers>
                                    <interactivity:EventTrigger EventName="MouseDoubleClick">
                                        <interactivity:InvokeCommandAction Command="{Binding RemoveCustomizedTestItemCommand}" 
							                CommandParameter="{Binding SelectedItem, ElementName=SelectedCustomizedTestItemListBox}" />
                                    </interactivity:EventTrigger>
                                </interactivity:Interaction.Triggers>
                            </ListBox>
                        </Border>
                    </Grid>
                    <Grid>
                        <Grid.Style>
                            <Style TargetType="{x:Type Grid}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsSwitchToOriginalTestItems}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Style>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <!-- Seperator -->
                            <ColumnDefinition Width="0" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Border Margin="0,0,10,0" Style="{StaticResource TestItemContainerBorder}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Margin="6" Text="躯干倾斜" Style="{StaticResource TestItemCategoryTitle}" />
                                <CheckBox Margin="0,6,2,8" HorizontalAlignment="Left" 
				                    Tag="{Binding ScoliosisATI}" Style="{StaticResource TestItemCheckBox}" />
                            </StackPanel>
                        </Border>
                        <Border Grid.Column="2" Margin="0,0,10,0" Style="{StaticResource TestItemContainerBorder}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Margin="6" Text="脊柱后凸" Style="{StaticResource TestItemCategoryTitle}" />
                                <CheckBox Margin="0,6,2,8" HorizontalAlignment="Left" 
                                    Tag="{Binding Kyphosis}" Style="{StaticResource TestItemCheckBox}" />
                            </StackPanel>
                        </Border>
                        <Border Grid.Row="1" Margin="0,10,10,0" Style="{StaticResource TestItemContainerBorder}">
                            <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                                <TextBlock Margin="6" Text="侧向弯曲" Style="{StaticResource TestItemCategoryTitle}" />
                                <CheckBox Margin="0,6,2,8" Tag="{Binding CervicalLateralBending}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding ThoracicLateralBending}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding LumbarLateralBending}" Style="{StaticResource TestItemCheckBox}" />
                            </StackPanel>
                        </Border>
                        <Border Grid.Row="1" Grid.Column="2" Margin="0,10,10,0" Style="{StaticResource TestItemContainerBorder}">
                            <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                                <TextBlock Margin="6" Text="前屈后伸" Style="{StaticResource TestItemCategoryTitle}" />
                                <CheckBox Margin="0,6,2,8" Tag="{Binding CervicalFlexExt}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding ThoracicFlexExt}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding LumbarFlexExt}" Style="{StaticResource TestItemCheckBox}" />
                            </StackPanel>
                        </Border>
                        <Border Grid.Row="2" Margin="0,10,10,0" Style="{StaticResource TestItemContainerBorder}">
                            <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                                <TextBlock Margin="6" Text="水平旋转" Style="{StaticResource TestItemCategoryTitle}" />
                                <CheckBox Margin="0,6,2,8" Tag="{Binding CervicalRotation}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding ThoracicRotation}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding LumbarRotation}" Style="{StaticResource TestItemCheckBox}" />
                            </StackPanel>
                        </Border>
                        <Border Grid.Row="2" Grid.Column="2" Margin="0,10,10,0" Style="{StaticResource TestItemContainerBorder}">
                            <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                                <TextBlock Margin="6" Text="身体平衡" Style="{StaticResource TestItemCategoryTitle}" />
                                <CheckBox Margin="0,6,2,8" Tag="{Binding HeadBalance}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,2,8" Tag="{Binding ShouldersBalance}" Style="{StaticResource TestItemCheckBox}" />
                                <CheckBox Margin="0,6,0,8" Tag="{Binding PelvicBalance}" Style="{StaticResource TestItemCheckBox}" />
                            </StackPanel>
                        </Border>
                    </Grid>
                    <StackPanel Margin="0,0,-15,0">
                        <RadioButton Height="219" Width="20" IsChecked="{Binding IsSwitchToOriginalTestItems}" Content="原始项目" Style="{StaticResource VerticalFlatRadioButton}" />
                        <RadioButton Height="219" Width="20" IsChecked="{Binding IsSwitchToCustomizedTestItems}" Content="自定义项目" Style="{StaticResource VerticalFlatRadioButton}" />
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="上一步" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Back.png" Style="{StaticResource NavigationButton}" Click="ButtonBack_Click" />
            <Button Content="取消" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Cancel.png" Style="{StaticResource NavigationButton}" Click="ButtonCancel_Click" />
            <Button Content="下一步" Tag="/Skins/Resource/Image/Next.png" Style="{StaticResource NavigationButton}" Command="{Binding NextCommand}" />
        </StackPanel>
    </Grid>
</shared:PageBase>
